/*
 * @Author: szx
 * @Date: 2021-12-02 16:11:26
 * @LastEditTime: 2021-12-02 16:21:30
 * @Description:
 * @FilePath: \leetcode\100-199\118\118.js
 */
/**
 * @param {number} numRows
 * @return {number[][]}
 */
var generate = function (numRows) {
    const res = [];
    for (let i = 0; i < numRows; i++) {
        let temp = new Array(i + 1).fill(1);
        for (let j = 1; j < i; j++) {
            temp[j] = res[i - 1][j - 1] + res[i - 1][j];
        }
        res.push(temp);
    }
    return res;
};
console.log(generate(5));
